package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;

@Getter
@Setter
@ToString
public class Courseorder {
    private Long id;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date inputTime;

    private Customer customer;

    private Classinfo classinfo;

    private Long money;

    public String getJson() {
        HashMap map = new HashMap();
        map.put("id", id);
        map.put("inputTime", inputTime);
        if (customer != null) {
            map.put("customer", customer);
        }
        if (classinfo != null) {
            map.put("classinfo", classinfo);
        }
        map.put("money", money);
        return JSON.toJSONString(map);
    }

}